import { Navigate } from 'react-router-dom'
import { lazy } from 'react'
const Login = lazy(() => import('../pages/Login/index.jsx'))
const Home = lazy(() => import('../pages/Home/index.jsx'))
const Redux = lazy(() => import('../pages/redux/index.jsx'))
const App = lazy(() => import('../pages/App/App.jsx'))
const Error = lazy(() => import('../pages/error/index'))
const react_hook = lazy(() => import('../pages/react_hook/index'))
const routes = [
	{
		path: '/',
		element: App,
		children: [
			{
				path: '/',
				element: <Navigate to={'/login'}></Navigate>,
				navigate: true,
			},
			{
				path: '/login',
				title: '登录',
				exact: true,
				element: Login,
			},
			{
				path: '/home',
				title: '首页',
				exact: true,
				element: Home,
			},
			{
				path: '/redux',
				title: 'redux学习',
				exact: true,
				element: Redux,
			},
			{
				path: '/react-hook',
				title: 'redux-hook学习',
				exact: true,
				element: react_hook,
			},
		],
	},
	{
		path: '*',
		title: '首页',
		element: Error,
	},
]
export default routes
